<template>
	<view class="preview">
		<swiper circular>
			<swiper-item v-for="ele in 5" :key="ele">
				<image @click="maskChange" src="../../common/images/preview_small.webp" mode="aspectFill"></image>
			</swiper-item>
		</swiper>
		<view class="masks" v-if="state" @click="maskChange">
			<view class="go_back" :style="{top: getStatusBarHeight()+'px'}">
				<uni-icons type="left" size="24" color="#fff"></uni-icons>
			</view>
			<view class="count">3 / 9</view>
			<view class="time">
				<uni-dateformat :date="Date.now()" format="hh:mm"></uni-dateformat>
			</view>
			<view class="date">
				<uni-dateformat :date="Date.now()" format="MM月dd日"></uni-dateformat>
			</view>
			<view class="footer">
				<view class="box" @click="clickInfo">
					<uni-icons type="info" size="24"></uni-icons>
					<view class="text">信息</view>
				</view>
				<view class="box">
					<uni-icons type="star-filled" size="24"></uni-icons>
					<view class="text">分数</view>
				</view>
				<view class="box">
					<uni-icons type="download" size="24"></uni-icons>
					<view class="text">下载</view>
				</view>
			</view>
		</view>
		<uni-popup ref="infoPopup" type="bottom">
			<view class="infoPopup">
				<view class="header">
					<view></view>
					<view class="title">壁纸信息</view>
					<uni-icons type="closeempty" size="24" @click="closeInfoPopup"></uni-icons>
				</view>
				<scroll-view scroll-y="true" >
					<view class="content">
						<view class="row">
							<view class="label">壁纸ID:</view>
							<text class="text" selectable>65dakhfa836dagjag</text>
						</view>
						<view class="row">
							<view class="label">发布者:</view>
							<text class="text" selectable>赖三炮</text>
						</view>
						<view class="row">
							<view class="label">评分:</view>
							<view class="value">
								<uni-rate :size="16" :value="5" readonly/>
								<text class="score" selectable>5分</text>
							</view>
						</view>
						<view class="row">
							<view class="label">摘要:</view>
							<text class="text" selectable>高标准高质量推进雄安新区建设、深入推进京津冀协同发展、加强荒漠化综合防治和推进“三北”等重点生态工程建设、新时代推动东北全面振兴、进一步推动长江经济带高质量发展、深入推进长三角一体化发展等区域发展</text>
						</view>
						<view class="row">
							<view class="label">标签:</view>
							<view class="value tabs">
								<view>
									<uni-tag text="标签1" circle type="primary"></uni-tag>
								</view>
								<view>
									<uni-tag text="标签1" circle type="primary"></uni-tag>
								</view>
								<view>
									<uni-tag text="标签1" circle type="primary"></uni-tag>
								</view>
							</view>
						</view>
					</view>
				</scroll-view>
			</view>
		</uni-popup>
	</view>
</template>

<script setup>
	import {getStatusBarHeight} from '@/utils/system.js'
	const state = ref(true)
	// 显示/关闭mask
	function maskChange(){
		console.log('--------')
		state.value = !state.value
	}
	// 显示图片信息
	const infoPopup = ref(null)
	function clickInfo(e){
		e.stopPropagation()
		infoPopup.value.open()
	}
	function closeInfoPopup(){
		infoPopup.value.close()
	}
</script>

<style lang="scss" scoped>
.preview{
	position: relative;
	width: 100%;
	height: 100vh;
	swiper{
		width: 100%;
		height: 100%;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.masks{
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		height: 100vh;
		&>view{
			position: absolute;
			left: 0;
			right: 0;
			margin: 0 auto;
			width: max-content;
			color: #fff;
		}
		.go_back{
			display: flex;
			align-items: center;
			justify-content: center;
			margin-left: 0;
			top: 0;
			left: 30rpx;
			width: 76rpx;
			height: 76rpx;
			background: rgba(0, 0, 0, 0.5);
			border-radius: 100rpx;
			backdrop-filter: blur(10rpx);
			border: 1rpx solid rgba(255, 255, 255, 0.3);
		}
		.count{
			top: 10vh;
			padding: 8rpx 28rpx;
			font-size: 28rpx;
			background: rgba(0, 0, 0, 0.3);
			border-radius: 40rpx;
			backdrop-filter: blur(20rpx);
		}
		.time{
			top: calc(10vh + 80rpx);
			left: 0;
			font-size: 140rpx;
			font-weight: 300;
			line-height: 1em;
			text-shadow: 0 4rpx rgba(0, 0, 0, 0.3);
		}
		.date{
			top: calc(10vh + 230rpx);
			font-size: 34rpx;
			text-shadow: 0 2rpx rgba(0, 0, 0, 0.3);
		}
		.footer{
			background-color: rgba(255, 255, 255, 0.8);
			display: flex;
			align-items: center;
			justify-content: space-around;
			bottom: 10vh;
			width: 65vw;
			height: 120rpx;
			border-radius: 60rpx;
			color: #000;
			box-shadow: 0 2rpx 0 rgba(0, 0, 0, 0.1);
			backdrop-filter: blur(20rpx);
			.box{
				display: flex;
				padding: 2rpx 12rpx;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				font-size: 26rpx;
				color: $text-font-color-2;
			}
		}
	}
	.infoPopup{
		padding: 30rpx;
		border-radius: 30rpx 30rpx 0 0;
		background-color: #fff;
		.header{
			display: flex;
			align-items: center;
			justify-content: space-between;
			.title{
				color: $text-font-color-2;
				font-size: 26rpx;
			}
			.close{
				padding: 6rpx;
			}
		}
		scroll-view{
			max-height: 40vh;
			.row{
				display: flex;
				padding: 16rpx 0;
				font-size: 32rpx;
				line-height: 1.7em;
				.label{
					color: $text-font-color-3;
					width: 140rpx;
					text-align: right;
					font-size: 30rpx;
				}
				.text{
					width: 0;
					flex: 1;
				}
				.value{
					display: flex;
					align-items: center;
					.score{
						padding-left: 20rpx;
					}
				}
				.tabs{
					flex-wrap: wrap;
					view{
						margin-right: 16rpx;
					}
				}
			}
		}
	}
}
</style>
